package com.san.common.auth.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;

@Data
@ToString(callSuper = true)
@TableName("users")
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId
    private Integer id;

    private Date createTime;

    private Date updateTime;

    /**
     * SysUser name.
     */
    private String username;

    /**
     * SysUser nick name,used to display on page.
     */
    private String nickname;

    /**
     * Password.
     */
    private String password;

    /**
     * SysUser email.
     */
    private String email;

    /**
     * SysUser avatar.
     */
    private String avatar;

    /**
     * SysUser description.
     */
    private String description;

    /**
     * Expire time.
     */
    private Date expireTime;

    /**
     * mfa type (current: tfa)
     */
    private Integer mfaType;

    /**
     * two factor auth key
     */
    private String mfaKey;

    public void init() {
        if (email == null) {
            email = "";
        }

        if (avatar == null) {
            avatar = "";
        }

        if (description == null) {
            description = "";
        }
    }
}